package com.ruoyi.api.controller.product;


import com.ruoyi.business.domain.product.TbProduct;
import com.ruoyi.business.domain.vo.product.TbProductVO;
import com.ruoyi.business.service.product.TbProductService;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Validated
@Api(value = "小程序用户兑换下单接口", tags = {"小程序用户兑换下单接口"})
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/miniapp/product")
public class ApiUserProductController {

    private final TbProductService tbProductService;

    @ApiOperation("积分商城商品列表")
    @GetMapping("/pointsMallList")
    public TableDataInfo<TbProductVO> add(TbProduct tbProduct, PageQuery pageQuery) {
        tbProduct.setIsPoints(1);
        return tbProductService.selectPageList(tbProduct, pageQuery);
    }
    @ApiOperation("积分商城商品详情")
    @GetMapping("/pointsMallDetail/{id}")
    public R<TbProductVO> detail(@PathVariable("id") Long id) {
        return R.ok(tbProductService.selectById(id));
    }
}
